package com.ruoyi.common.core.service;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;

/**
 * Service 基类
 */
public class BaseServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {

    protected void exNull(Object o, String s) throws ServiceException {
        if (StringUtils.isNull(o)) {
            throw new ServiceException(s);
        }
    }

    protected void ex(boolean o, String s) throws ServiceException {
        if (o) {
            throw new ServiceException(s);
        }
    }

    protected void ex(String s) throws ServiceException {
        throw new ServiceException(s);
    }

}
